<%@page import="java.text.DateFormat"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ page
	import="ra.db.connections.*,java.sql.ResultSet,java.sql.SQLException"
	import="front.net.entity.cookie.ICookieConstant"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<jsp:useBean id="userCookie" scope="session"
	class="front.net.entity.cookie.UserCookie" />
<jsp:useBean id="user" scope="session" class="front.net.entity.User" />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>用户管理中心</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css" href="css/index.css" />
<link rel="stylesheet" type="text/css" href="css/common.css" />
<link rel="stylesheet" type="text/css" href="css/form.css" />
<script type="text/javascript" src="js/Page.js"></script>
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		$('.navpanitem').mouseover(function() {
			$(this).css({
				'background' : '#DDDDDD',
				'cursor' : 'pointer'
			}).siblings().css({
				'background' : 'white',
				'cursor' : 'default'
			});
		}).mouseout(function() {
			$(this).css({
				'background' : 'white',
				'cursor' : 'default'
			});
		}).click(function() {
			$(this).css({
				'color' : '#cc0000'
			}).siblings().css({
				'color' : '#000000'
			});
			$(this).children('.navpan-indicator').css({
				'background' : '#cc0000'
			}).parent().siblings().children('.navpan-indicator').css({
				'background' : '#fff'
			});
		});
		$('#product-logo').mouseover(function() {
			$(this).css({
				'cursor' : 'pointer'
			});
		}).mouseout(function() {
			$(this).css({
				'cursor' : 'default'
			});
		});
		$('#logout').click(function() {
			clearCookies();
			window.location.href = "/PkiSys/login.jsp";
		}).mouseover(function() {
			$(this).css({
				'color' : '#cc0000',
				'cursor' : 'pointer'
			});
		}).mouseout(function() {
			$(this).css({
				'color' : 'black',
				'cursor' : 'default'
			});
		});
		$('#CTOperateHistory').click(function() {
			$.ajax({
				type : "POST",
				url : "CTOperateHistory.jsp",
				dataType : "html",
				success : function(data) {
					$('#ajax').html(data);
					$.getScript("js/CTOperateHistory.js", reRegist);
				}
			});
		});
		$('#InfView').click(function() {
			$.ajax({
				type : "POST",
				url : "InfView.jsp",
				dataType : "html",
				data : "username=" + name,
				success : function(data) {
					$('#ajax').html(data);
					$.getScript("js/InfView.js",reRegistCTApply);
				}
			});
		});
		$('#HistoryCTView').click(function() {
			$.ajax({
				type : "POST",
				url : "HistoryCTView.jsp",
				dataType : "html",
				data : "username=" + name,
				success : function(data) {
					$('#ajax').html(data);
					$.getScript("js/HistoryCTView.js", reRegist);
				}
			});
		});
		$('#CTOperate').click(function() {
			$.ajax({
				type : "POST",
				url : "CTOperate.jsp",
				dataType : "html",
				data : "username=" + name,
				success : function(data) {
					$('#ajax').html(data);
					$.getScript("js/CTOperate.js");
				}
			});
		});
		$('#CTApply').click(function() {
			$.ajax({
				type : "POST",
				url : "CTApply.jsp",
				dataType : "html",
				data : "username=" + name,
				success : function(data) {
					$('#ajax').html(data);
					$.getScript("js/CTApply.js", reRegistCTApply);
				}
			});
		});
		$('#CTVerify').click(function() {
			$.ajax({
				type : "POST",
				url : "CTVerify.jsp",
				dataType : "html",
				data : "username=" + name,
				success : function(data) {
					$('#ajax').html(data);
					$.getScript("js/CTVerify.js", reRegist);
				}
			});
		});
	});
	function reRegist() {
		//重新注册绑定事件
		$('.container-row').mouseover(function() {
			$(this).css({
				'background' : '#ffeebb'
			}).siblings().css({
				'background' : 'white'
			});
		}).mouseout(function() {
			$(this).css({
				'background' : 'white'
			});
		}).click(function() {
			$(this).children('.active-indicator').css({
				'background' : '#0066ff'
			});
			$(this).siblings().children('.active-indicator').css({
				'background' : '#fff'
			});
		});
		$('.nextPage').click(function() {
			page.nextPage();
		}).mouseover(function() {
			$(this).css({
				'cursor' : 'pointer',
				'corlor' : '#00dddd'
			});
		}).mouseout(function() {
			$(this).css({
				'cursor' : 'default',
				'corlor' : '#fff'
			});
		});
		$('.prePage').click(function() {
			page.prePage();
		}).mouseover(function() {
			$(this).css({
				'cursor' : 'pointer',
				'corlor' : '#00dddd'
			});
		}).mouseout(function() {
			$(this).css({
				'cursor' : 'default',
				'corlor' : '#fff'
			});
		});
	}
	function reRegistCTApply() {
		$('#submit-button').mouseover(function() {
			$(this).css({
				'border' : '1px solid',
				'corlor' : 'black'
			});
		}).mouseout(function() {
			$(this).css({
				'border' : 'thin',
				'corlor' : 'gray'
			});
		});
	}
</script>
</head>

<body>
	<%
		userCookie.initUser(request);
		user = userCookie.getUser();
	%>
	<div id="header">
		<table cellpadding="0" cellspacing="0" border="0">
			<tbody>
				<tr>
					<td style="width: 400px; height: 80px"><div id="systemname">
							<h1>Certificate Authority</h1>
						</div>
					</td>
					<td>
						<div id="username" style="width: 100px; height: 80px">
							<p>
								用户名：
								<%=user.getUsername()%></p>
						</div>
					</td>
					<td><div id="logoutdiv" style="width: 100px; height: 80px">
							<a id="logout">登出</a>
						</div>
					</td>
				</tr>
				<tr>
					<td style="width: 520px; height: 20px"></td>
					<td style="width: 280px; height: 20px">
						<div id="time">
							<%
								Date date = new Date();
								DateFormat dateFormat = DateFormat.getInstance();
								out.println("<p id='currentTime'>" + "现在时间是 "
										+ dateFormat.format(date) + "</p>");
							%>
						</div>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
	<div class="spacer"></div>
	<div>
		<table cellpadding="0" cellspacing="0" border="0">
			<tbody>
				<tr>
					<td valign="top"
						style="box-sizing:border-box;width:160px;height:500px;">
						<div id="navpan" style="width:160px;height:500px;">
							<div id="product-logo">
								<a>证书</a>
							</div>
							<div id="navpan-controller" style="height:200px">
								<div id="navpanlist">
									<div class="navpanitem" id="CTOperateHistory">
										<div class="navpan-indicator"></div>
										<div class="navpantiemname">历史记录</div>
									</div>
									<div class="navpanitem" id="InfView">
										<div class="navpan-indicator"></div>
										<div class="navpantiemname">查看信息</div>
									</div>
									<div class="navpanitem" id="HistoryCTView">
										<div class="navpan-indicator"></div>
										<div class="navpantiemname">历史证书</div>
									</div>
									<div class="navpanitem" id="CTOperate">
										<div class="navpan-indicator"></div>
										<div class="navpantiemname">证书操作</div>
									</div>
									<div class="navpanitem" id="CTApply">
										<div class="navpan-indicator"></div>
										<div class="navpantiemname">证书申请</div>
									</div>
									<div class="navpanitem" id="CTVerify">
										<div class="navpan-indicator"></div>
										<div class="navpantiemname">证书审核</div>
									</div>
								</div>
							</div>
						</div></td>
					<td>
						<div style="width:650px;height:500px;">
							<table cellpadding="0" cellspacing="0" border="0">
								<tbody>
									<tr>
										<td id="ajax"></td>
									</tr>
								</tbody>
							</table>
						</div>
					</td>
			</tbody>
		</table>
	</div>
	<div id="footer">
		<p>2013年毕业设计作品-证书中心</p>
	</div>
	<script type="text/javascript">
		var isManager =
	<%=CTIDPsw.checkMgr(user.getUsername())%>
		;
		if (!isManager) {
			var navpan = document.getElementById("navpanlist");
			var ctVerify = document.getElementById("CTVerify");
			navpan.removeChild(ctVerify);
		};
	</script>
</body>
</html>
